{% extends "layui/admin/base.html" %}
{% block title %}用户详情{% endblock %}

{% block content %}
    <h1 class="mb-4">用户详情</h1>

    <form method="post" action="{{ url_for('admin.update_user', user_id=user.id) }}">
        <div class="mb-3">
            <label class="form-label">用户名</label>
            <input type="text" class="form-control" name="username" value="{{ user.username }}" required>
        </div>
        <div class="mb-3">
            <label class="form-label">邮箱</label>
            <input type="email" class="form-control" name="email" value="{{ user.email }}">
        </div>
        <div class="mb-3">
            <label class="form-label">角色</label>
            <select name="role" class="form-select">
                <option value="admin" {% if user.role == 'admin' %}selected{% endif %}>管理员</option>
                <option value="user" {% if user.role == 'user' %}selected{% endif %}>普通用户</option>
            </select>
        </div>
        <div class="mb-3">
            <label class="form-label">状态</label>
            <select name="is_deleted" class="form-select">
                <option value="0" {% if not user.is_deleted %}selected{% endif %}>正常</option>
                <option value="1" {% if user.is_deleted %}selected{% endif %}>禁用</option>
            </select>
        </div>
        <button type="submit" class="btn btn-primary">保存修改</button>
        <a href="{{ url_for('admin.users') }}" class="btn btn-secondary">返回</a>
    </form>
{% endblock %}
